const p_1 = new Promise((resolve, reject) => {
    // resolve('init')
    reject('reason')
}).then(res => {
    console.log(res, 'first then')
}).then(res => {
    console.log(res, 'second then')
}).catch(reason => {
    console.log(reason, 'first catch')
}).catch(reason => {
    console.log(reason, 'second catch')
})

const p_2 = new Promise((resolve, reject) => {
    resolve('init')
    // reject('reason')
})
p_2.catch(e => e)
Promise.resolve({then:(v) => {}}).then(res => {
    console.log('Promise.resolve', res)
})

Promise.resolve(p_2).then(res => {
    console.log('Promise.resolve(p_2) value', res)
}, reason => {
    console.log('Promise.resolve(p_2) reason', reason)
})

Promise.reject(p_2).then(res => {
    console.log('Promise.reject(p_2) value', res)
}, reason => {
    console.log('Promise.reject(p_2) reason', reason)
})

Promise.all(new Set([1,3, p_2])).then(res => {
    console.log('Promise.all([1,3, p_2])', res)
},reason => {
    console.log('Promise.all([1,3, p_2])', reason)
})

Promise.all('1234').then(res => {
    console.log('Promise.all', res)
    return 'before finally'
}).finally(() => {
    return 'finally return'
}).then(value => {
    console.log('then after finally', value)
})

try{
    for(let i of '123') {
        console.log(i)
    }
}catch(e) {
console.log("e", e.message)
    
}